<template>
  <div class="main">
    <MyHeader title="购物车案例" color="buler"></MyHeader>
    <MyGoods :arr="item" v-for="item in list" :key="item.id"></MyGoods>
    <MyFooter :arr="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";
export default {
  components: { MyHeader, MyGoods, MyFooter },
  data() {
    return {
      list: [],
    };
  },
  //   获取数据
  created() {
    this.$axios({
      url: "/api/cart",
    }).then((res) => {
      console.log(res.data);
      this.list = res.data.list;
    });
  },
};
</script>

<style scoped>
.main {
  padding-top: 45px;
  padding-bottom: 50px;
}
</style>